<template>
  <div class="app-container">
  <!-- 录取学生 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" >

      <el-form-item label="学生姓名" prop="name" >
        <el-input
          v-model="queryParams.name"
          placeholder="请输入学生姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="身份证号" prop="idcard" >
        <el-input
          v-model="queryParams.idcard"
          placeholder="请输入身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="志愿区县" prop="areaId" >

        <el-select v-model="queryParams.areaId" placeholder="请选择志愿区县" @change="selectSchoolArea">
          <el-option
            v-for="item in areaOptions"
            :key="item.coded"
            :label="item.name"
            :value="item.coded">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="开始日期">
        <el-date-picker
          v-model="queryParams.startTime"
          type="date"
          placeholder="开始日期"
          value-format="yyyy-MM-dd"
          format="yyyy 年 MM 月 dd 日"
          >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="结束日期">
        <el-date-picker
          v-model="queryParams.endTime"
          type="date"
          placeholder="选择结束日期"
          value-format="yyyy-MM-dd"
          format="yyyy 年 MM 月 dd 日"
          >
        </el-date-picker>
      </el-form-item>
      <!-- <el-form-item label="状态">
        <el-select v-model="queryParams.status" clearable placeholder="选择状态">
            <el-option
              v-for="item in statusOptionsArr"
              :key="item.id"
              :label="item.label"
              :value="item.id"
              @keyup.enter.native="handleQuery"
              >
            </el-option>
          </el-select>
      </el-form-item> -->

      <!-- <el-form-item label="填报志愿学校" prop="enrolCode" >

        <el-select v-model="queryParams.enrolCode" placeholder="请选择志愿区县">
          <el-option
            v-for="item in schoolAreaOptions"
            :key="item.id"
            :label="item.name"
            :value="item.id">
          </el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item style="position: absolute;right:50px;">
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" >搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <!-- <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['admin:student:add']"
        >新增</el-button>
      </el-col> -->
      <!-- <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleAdmission"
        >录取</el-button>

      </el-col> -->
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-finished"
          size="mini"
          :disabled="multiple"
          @click="handleAgree"
        >同意</el-button>
      </el-col>
      <el-col :span="2">
        <el-button
          type="danger"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleExamine"
        >拒绝</el-button>
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="studentList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="学生姓名" align="center" prop="name" />
      <el-table-column label="身份证号" align="center" prop="idcard" width="170"/>
      <el-table-column label="志愿学校名称" align="center" prop="enrolName" width="250"/>
      <!-- <el-table-column label="户籍所在地" align="center" prop="streetStr" width="200"/> -->
      <!-- <el-table-column label="与户主关系" align="center" prop="hukouRelate" /> -->
      <el-table-column label="迁户日期" align="center" prop="hukouDate" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.hukouDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="与户主关系" align="center" prop="hukouRelateStr" />
      <el-table-column label="房产地址" align="center" prop="propertyAddress" />
      <el-table-column label="状态" align="center" prop="statusStr" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleInfo(scope.row)"
          >详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 添加或修改学生对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules"  :inline="true" label-position="top" size="small" style="padding-left:50px;">
        <el-form-item label="学生姓名" prop="name" style="width: 22%;">
          <el-input v-model="form.name" placeholder="请输入学生姓名" />
        </el-form-item>
        <el-form-item label="出生日期" prop="birthday" style="width: 22%;">
          <el-date-picker clearable
            v-model="form.birthday"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择出生日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="身份证" prop="idcard" style="width: 22%;">
          <el-input v-model="form.idcard" placeholder="请输入身份证" />
        </el-form-item>
        <el-form-item label="学籍号" prop="code" style="width: 22%;">
          <el-input v-model="form.code" placeholder="请输入学籍号" />
        </el-form-item>
        <el-form-item label="登陆密码" prop="password" style="width: 22%;">
          <el-input v-model="form.password" placeholder="请输入登陆密码" />
        </el-form-item>

        <el-form-item label="户口所在地" prop="streetId" style="width: 22%;">
          <!-- <el-input v-model="form.streetId" placeholder="请输入户口所在地" /> -->
          <el-select v-model="form.streetId" clearable placeholder="请选择学校区域">
            <el-option
              v-for="item in areaOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
              @keyup.enter.native="handleQuery"
              >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="户籍详细地址" prop="hukouAddress" style="width: 22%;">
          <el-input v-model="form.hukouAddress" placeholder="请输入户籍详细地址" />
        </el-form-item>
        <el-form-item label="街道详情" prop="streetStr" style="width: 22%;">
          <el-input v-model="form.streetStr" placeholder="请输入街道详情" />
        </el-form-item>
        <el-form-item label="区域" prop="areaId" style="width: 22%;">
          <!-- <el-input v-model="form.areaId" placeholder="请输入区域" /> -->
          <el-select v-model="form.areaId" clearable placeholder="请选择学校区域" @change="selectSchoolArea">
            <el-option
              v-for="item in areaOptions"
              :key="item.coded"
              :label="item.name"
              :value="item.coded"
              @keyup.enter.native="handleQuery"
              >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="填报志愿学校" prop="enrolCode" style="width: 22%;">
          <!-- <el-input v-model="form.enrolCode" placeholder="请输入填报志愿学校" /> -->
          <el-select v-model="form.enrolCode" clearable placeholder="请选择学校">
            <el-option
              v-for="item in schoolAreaOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
              @keyup.enter.native="handleQuery"
              >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="毕业学校标识码" prop="graduateCode" style="width: 22%;">
          <el-input v-model="form.graduateCode" placeholder="请输入毕业学校标识码" />
        </el-form-item>
        <el-form-item label="学校班级" prop="schoolClass" style="width: 22%;">
          <el-input v-model="form.schoolClass" placeholder="请输入学校班级" />
        </el-form-item>
        <el-form-item label="报名时间" prop="applyTime" style="width: 22%;">
          <el-date-picker clearable
            v-model="form.applyTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择报名时间">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="房产地址" prop="propertyAddress" style="width: 22%;">
          <el-input v-model="form.propertyAddress" placeholder="请输入房产地址" />
        </el-form-item>
        <el-form-item label="购房时间" prop="propertyDate" style="width: 22%;">
          <el-date-picker clearable
            v-model="form.propertyDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择购房时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="房主" prop="propertyOwner" style="width: 22%;">
          <el-input v-model="form.propertyOwner" placeholder="请输入房主" />
        </el-form-item>
        <el-form-item label="房主身份证" prop="ownerCard" style="width: 22%;">
          <el-input v-model="form.ownerCard" placeholder="请输入房主身份证" />
        </el-form-item>
        <el-form-item label="与户主关系" prop="hukouRelate" style="width: 22%;">
          <el-input v-model="form.hukouRelate" placeholder="请输入与户主关系" />
        </el-form-item>
        <el-form-item label="与房主关系" prop="propertyRelate" style="width: 22%;">
          <el-input v-model="form.propertyRelate" placeholder="请输入与房主关系" />
        </el-form-item>
        <el-form-item label="房产证书编号" prop="propertyCode" style="width: 22%;">
          <el-input v-model="form.propertyCode" placeholder="请输入房产证书编号" />
        </el-form-item>
        <el-form-item label="迁户日期" prop="hukouDate" style="width: 22%;">
          <el-date-picker clearable
            v-model="form.hukouDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择迁户日期">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="邮箱" prop="email" style="width: 22%;">
          <el-input v-model="form.email" placeholder="请输入邮箱" />
        </el-form-item>
        <el-form-item label="监护人" prop="chaperon" style="width: 22%;">
          <el-input v-model="form.chaperon" placeholder="请输入监护人" />
        </el-form-item>
        <el-form-item label="监护人电话" prop="chaperonPhone" style="width: 22%;">
          <el-input v-model="form.chaperonPhone" placeholder="请输入监护人电话" />
        </el-form-item>
        <el-form-item label="监护人身份证" prop="chaperonCard" style="width:22%;">
          <el-input v-model="form.chaperonCard" placeholder="请输入监护人身份证" />
        </el-form-item>
        <el-form-item label="监护人关系" prop="chaperonRelate" style="width: 22%;">
          <el-input v-model="form.chaperonRelate" placeholder="请输入监护人关系" />
        </el-form-item>
        <el-form-item label="监护人2" prop="chaperon1" style="width: 22%;">
          <el-input v-model="form.chaperon1" placeholder="请输入监护人2" />
        </el-form-item>
        <el-form-item label="监护人2电话" prop="chaperon1Phone" style="width: 22%;">
          <el-input v-model="form.chaperon1Phone" placeholder="请输入监护人2电话" />
        </el-form-item>
        <el-form-item label="监护人2身份证" prop="chaperon1Card" style="width: 22%;">
          <el-input v-model="form.chaperon1Card" placeholder="请输入监护人2身份证" />
        </el-form-item>
        <el-form-item label="监护人2关系" prop="chaperon1Relate" style="width: 22%;">
          <el-input v-model="form.chaperon1Relate" placeholder="请输入监护人2关系" />
        </el-form-item>
        <el-form-item label="退回原因" prop="reason" style="width: 22%;">
          <el-input v-model="form.reason" placeholder="请输入退回原因" />
        </el-form-item>
        <el-form-item label="备注" prop="remark" style="width: 22%;">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 详情 -->
    <el-dialog
      title="学生详情"
      :visible.sync="dialogVisibleInfo"
      width="80%"
      >
      <!-- :before-close="handleClose" -->
      <div style="width: 99%;height:auto;margin: 10px auto;">
        <el-descriptions title="" :column="3">
            <el-descriptions-item label="学生姓名" >{{ studentInfoData.name }}</el-descriptions-item>
            <el-descriptions-item label="性别" >{{ studentInfoData.sexStr }}</el-descriptions-item>
            <el-descriptions-item label="学籍号" >{{ studentInfoData.code }}</el-descriptions-item>
            <el-descriptions-item label="身份证" >{{ studentInfoData.ownerCard }}</el-descriptions-item>
            <!-- <el-descriptions-item label="学生姓名" >{{ studentInfoData.name }}</el-descriptions-item> -->
            <el-descriptions-item label="出生日期" >{{ studentInfoData.birthday }}</el-descriptions-item>
            <!-- <el-descriptions-item label="学籍号" >{{ studentInfoData.code }}</el-descriptions-item> -->
            <el-descriptions-item label="户口所在地" >{{ studentInfoData.areaIdStr }}</el-descriptions-item>
            <el-descriptions-item label="街道" >{{ studentInfoData.streetStr }}</el-descriptions-item>
            <el-descriptions-item label="户籍详细地址" >{{ studentInfoData.hukouAddress }}</el-descriptions-item>
            <el-descriptions-item label="填报志愿学校" >{{ studentInfoData.enrolName }}</el-descriptions-item>
            <!-- <el-descriptions-item label="毕业学校标识码" >{{ studentInfoData.graduateCode }}</el-descriptions-item> -->
            <!-- <el-descriptions-item label="学校班级" >{{ studentInfoData.schoolClass }}</el-descriptions-item> -->
            <!-- <el-descriptions-item label="报名时间" >{{ studentInfoData.applyTime }}</el-descriptions-item> -->
            <el-descriptions-item label="房产地址" >{{ studentInfoData.propertyAddress }}</el-descriptions-item>
            <!-- <el-descriptions-item label="报名时间" >{{ studentInfoData.applyTime }}</el-descriptions-item> -->
            <el-descriptions-item label="购房时间" >{{ studentInfoData.propertyDate }}</el-descriptions-item>
            <el-descriptions-item label="房主" >{{ studentInfoData.propertyOwner }}</el-descriptions-item>
            <el-descriptions-item label="房主身份证" >{{ studentInfoData.ownerCard }}</el-descriptions-item>
            <el-descriptions-item label="与户主关系" >{{ studentInfoData.hukouRelateStr }}</el-descriptions-item>
            <el-descriptions-item label="与房主关系" >{{ studentInfoData.propertyRelateStr }}</el-descriptions-item>
            <el-descriptions-item label="房产证书编号" >{{ studentInfoData.propertyCode }}</el-descriptions-item>
            <el-descriptions-item label="迁户日期" >{{ studentInfoData.hukouDate }}</el-descriptions-item>
            <!-- <el-descriptions-item label="邮箱" >{{ studentInfoData.email }}</el-descriptions-item> -->
            <el-descriptions-item label="监护人" >{{ studentInfoData.chaperon }}</el-descriptions-item>
            <el-descriptions-item label="监护人电话" >{{ studentInfoData.chaperonPhone }}</el-descriptions-item>
            <!-- <el-descriptions-item label="监护人身份证" span="2">{{ studentInfoData.chaperonCard }}</el-descriptions-item> -->
            <!-- <el-descriptions-item label="监护人关系" >{{ studentInfoData.chaperonRelate }}</el-descriptions-item> -->
            <el-descriptions-item label="监护人2" >{{ studentInfoData.chaperon1 }}</el-descriptions-item>
            <el-descriptions-item label="监护人2电话" >{{ studentInfoData.chaperon1Phone }}</el-descriptions-item>
            <!-- <el-descriptions-item label="监护人2身份证" >{{ studentInfoData.chaperon1Card }}</el-descriptions-item> -->
            <!-- <el-descriptions-item label="监护人2关系" >{{ studentInfoData.chaperon1Relate }}</el-descriptions-item> -->
            <!-- <el-descriptions-item label="退回原因" >{{ studentInfoData.reason }}</el-descriptions-item> -->
            <el-descriptions-item label="备注" >{{ studentInfoData.remark }}</el-descriptions-item>
        </el-descriptions>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleInfo = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisibleInfo = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { listStudent, getStudent, delStudent, addStudent, updateStudent } from "@/api/admin/student";
import {getContentArea } from "@/api/admin/content";
import { getSchoolArea } from "@/api/admin/school";
import { admissionStudent } from "@/api/studentAdmissionReview/student";
import { reviewStudent } from "@/api/studentAdmissionReview/student";
export default {
  name: "Student",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 学生表格数据
      studentList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        // code: null,
        // password: null,
        name: null,
        // sex: null,
        // birthday: null,
        idcard: null,
        // loginType: null,
        // graduateCode: null,
        // enrolType: null,
        // enrolCode: null,
        streetId: null,
        startTime:'',
        endTime:'',
        status:3,
        // areaId: null,
        // streetStr: null,
        // hukouRelate: null,
        // hukouDate: null,
        // hukouAddress: null,
        // hukouPropertyType: null,
        // propertyType: null,
        // propertyAddress: null,
        // propertyOwner: null,
        // ownerCard: null,
        // propertyCode: null,
        // propertyRelate: null,
        // propertyDate: null,
        // schoolClass: null,
        // applyTime: null,
        // email: null,
        // chaperon: null,
        // chaperonPhone: null,
        // chaperonCard: null,
        // chaperonRelate: null,
        // chaperon1: null,
        // chaperon1Phone: null,
        // chaperon1Card: null,
        // chaperon1Relate: null,
        // reason: null,

      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {

      },
      areaOptions:[],
      schoolAreaOptions:[],
      hukouRelateRange:[
        { value: 1, text: "子(女)" },
        { value: 2, text: "孙子(女)或外孙子(女)"},
        { value: 3, text: "兄(弟、姐、妹)" },
        { value: 4, text: "本人" },
        { value: 5, text: "其他亲属"},
        { value: 6, text: "非亲属" }
      ],
      dialogVisibleInfo:false,
      studentInfoData:{},
      chaperonRelateRange: [
        { value: 1, text: "子(女)" },
        { value: 2, text: "孙子(女)或外孙子(女)"},
        { value: 3, text: "兄(弟、姐、妹)" },
        { value: 4, text: "本人" },
        { value: 5, text: "其他亲属"},
        { value: 6, text: "非亲属" }

      ],
      searchTime:'',
      statusOptionsArr:[
        {
          id:1,
          label:'已注册'
        },
        {
          id:2,
          label:'已报名'
        },
        {
          id:3,
          label:'已审核'
        },
        {
          id:4,
          label:'已录取'
        },
      ]

    };
  },
  created() {
    this.getList();
    this.getAreaFun();

  },
  methods: {
    /** 查询学生列表 */
    getList() {
      this.loading = true;
      listStudent(this.queryParams).then(response => {
        console.log('---response查询学生列表',response)
        this.studentList = response.rows;
        this.studentList.forEach(element => {
            if(element.status == 1){
              element.statusStr  = '已注册';
            }else if(element.status == 2){
              element.statusStr  = '已报名';
            }else if(element.status == 3){
              element.statusStr  = '已审核';
            }else if(element.status == 4){
              element.statusStr  = '已录取';
            }

            if(element.sex == 1){
              element.sexStr = '男'
            }else if(element.sex == 0){
              element.sexStr = '女'
            }
            // 处理区域
          console.log('处理区域',this.areaOptions)
          this.areaOptions.forEach(it=>{
              if(it.coded == element.areaId){
                element.areaIdStr = it.name;
              }
          })
           // 处理户主关系
           this.hukouRelateRange.forEach(it=>{
            if(it.value == element.hukouRelate){
              element.hukouRelateStr = it.text;
            }
          })
           // 处理房主关系
           this.chaperonRelateRange.forEach(it=>{
            if(it.value == element.hukouRelate){
              element.propertyRelateStr = it.text;
            }
          })
        });
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        code: null,
        password: null,
        name: null,
        sex: null,
        birthday: null,
        idcard: null,
        loginType: null,
        graduateCode: null,
        enrolType: null,
        enrolCode: null,
        streetId: null,
        areaId: null,
        streetStr: null,
        hukouRelate: null,
        hukouDate: null,
        hukouAddress: null,
        hukouPropertyType: null,
        propertyType: null,
        propertyAddress: null,
        propertyOwner: null,
        ownerCard: null,
        propertyCode: null,
        propertyRelate: null,
        propertyDate: null,
        schoolClass: null,
        applyTime: null,
        email: null,
        chaperon: null,
        chaperonPhone: null,
        chaperonCard: null,
        chaperonRelate: null,
        chaperon1: null,
        chaperon1Phone: null,
        chaperon1Card: null,
        chaperon1Relate: null,
        reason: null,
        status: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加学生";
      this.getAreaFun()

    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getStudent(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改学生";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateStudent(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            console.log(this.form)
            addStudent(this.form).then(response => {
              console.log(response)
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除学生编号为"' + ids + '"的数据项？').then(function() {
        return delStudent(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    // handleExport() {
    //   this.download('admin/student/export', {
    //     ...this.queryParams
    //   }, `student_${new Date().getTime()}.xlsx`)
    // }
    // 查看详情
    handleInfo(row){
      console.log('----查看详情',row)
      console.log('----查看详情',row)
      this.dialogVisibleInfo = true;
      this.studentInfoData= row;
    },
    // 查询区域下拉框
    getAreaFun(){
        getContentArea().then(response => {
            console.log('查询区域下拉框',response)
            if(response.code == 200){

                this.areaOptions = response.data;


            }
        });
    },
    selectSchoolArea(e){

      let areaIdStr = e.toString()
      console.log('----areaIdStr',typeof areaIdStr)
      this.getSchoolAreaFun(areaIdStr)
    },
    getSchoolAreaFun(areaId){
      getSchoolArea(areaId).then(response => {
            console.log('查询学校数据下拉框',response)
            if(response.code == 200){
                this.schoolAreaOptions = response.data;
                // console.log('-----this.schoolList---this.schoolAreaOptions',this.schoolList)
            }
        });
     },
     handleAgree(){
      console.log('----录取',this.ids);

      this.$confirm('是否录取选中的学生?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {

          let parmData = {
            "ids":this.ids,
            "status":4,
          }
          this.loading = true;
          admissionStudent(parmData).then(response => {
            this.$message({
                type: 'success',
                message: '录取成功!'
              });
              setTimeout( ()=> {

                this.getList()
                this.loading = false;
              }, 1500);

          });

        }).catch(() => {
          this.loading = false;
          this.$message({
            type: 'info',
            message: '已取消录取操作'
          });
        /*
          this.loading = true;
          this.$prompt('请输入退回理由', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
            }).then(({ value }) => {
                let parmData = {
                  "ids":this.ids,
                  "status":0,
                  "reason":value
                }
                reviewStudent(parmData).then(response => {
                  console.log('---审核学生-',response)
                  this.loading = false;

                  this.$message({
                    type: 'warning',
                    message: '拒绝通过操作成功！'
                  });
                  setTimeout( ()=> {
                    // this.open = false;
                    this.getList()
                  }, 1500);

                });

            }).catch(() => {

              this.loading = false;
              setTimeout( ()=> {
                // this.open = false;
                this.$message({
                  type: 'info',
                  message: '取消输入'
                });
              }, 1500);
            });
             */
        });


     },
     /**  录取拒绝学生*/
    handleExamine() {
      console.log('---parmData',this.ids)

      this.$prompt('请输入拒绝理由', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(({ value }) => {
            let parmData = {
              "ids":this.ids,
              "status":0,
              "reason":value
            }
            this.loading = true;
            reviewStudent(parmData).then(response => {
              console.log('---拒绝录取学生-',response)


              this.$message({
                type: 'warning',
                message: '拒绝录取操作成功！'
              });
              setTimeout( ()=> {
                this.getList()
                this.loading = false;
              }, 1500);

            });

        }).catch(() => {


          setTimeout( ()=> {
            this.loading = false;
            this.$message({
              type: 'info',
              message: '取消操作'
            });
          }, 1500);
        });
    },
  }
};
</script>
